package com.example.mybluetooth.bean;

import android.bluetooth.BluetoothDevice;
import android.bluetooth.le.ScanRecord;
import android.bluetooth.le.ScanResult;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.Arrays;

public class BleDevice {
    public BluetoothDevice device;
    public Integer rssi;
    public byte[] scanRecordBytes;
//    默认设备是可以连接的，
    public boolean isConnectable=true;
    @Nullable
    public ScanRecord scanRecord;

    public BleDevice(BluetoothDevice device, Integer rssi, byte[] scanRecordBytes, boolean isConnectable, @Nullable ScanRecord scanRecord) {
        this.device = device;
        this.rssi = rssi;
        this.scanRecordBytes = scanRecordBytes;
        this.isConnectable = isConnectable;
        this.scanRecord = scanRecord;
    }

    public BleDevice(BluetoothDevice device, Integer rssi, byte[] scanRecordBytes, @Nullable ScanRecord scanRecord) {
        this.device = device;
        this.rssi = rssi;
        this.scanRecordBytes = scanRecordBytes;
        this.scanRecord = scanRecord;
    }

    public BleDevice(BluetoothDevice device, int rssi, byte[] scanRecordBytes) {
        this.device = device;
        this.rssi = rssi;
        this.scanRecordBytes = scanRecordBytes;
    }
//为了调试方便，增加以下toString方法
    @Override
    @NonNull
    public String toString() {
        return "BleDevice{" +
                "device=" + device +
                ", rssi=" + rssi +
                ", scanRecordBytes=" + Arrays.toString(scanRecordBytes) +
                ", isConnectable=" + isConnectable +
                ", scanRecord=" + scanRecord +
                '}';
    }
}
